package com.ruijie.autotest.log.impl.data;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruijie.autotest.log.core.data.IRow;
import com.ruijie.autotest.log.core.data.ITable;

public class JsonTable implements ITable {

	private final JSONArray rows;

	public JsonTable(String jsonAsText) {
		rows = (JSONArray) JSON.parse(jsonAsText);
	}

	@Override
	public IRow getRow(int rowAt) {
		return new JsonRow(((JSONObject) rows.get(rowAt)));
	}

	@Override
	public int count() {
		// FIXME 2021/1/7  wait for me!!!
		throw new RuntimeException();
	}
}
